home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 4 / FM Towns Free Software Collection 4 - Disc 1.iso / t_os / cdda_kd / cdda.c next >
Text File  |  1991-10-18  |  14KB  |  691 lines

  1. /*
  2.  *  cdda
  3.  *        CD_DA module.
  4.  *  cdda.c
  5.  *
  6.  *  #1  90.10.09
  7.  *  #2  90.10.15
  8.  *    #3    90.10.18
  9.  *    hc386 cdda
  10.  *    386link main cdda -f:\highc\cdr f:\highc\tbios f:\highc\snd f:\highc\hce
  11.  *        -nom -twocase -callbufs 4 -stack 80000 -pack -e cdda
  12.  */
  13. char *cdda_e="cdda_3";
  14.  
  15. #include    <egb.h>
  16. #include    <cdr.h>
  17. #include    <snd.h>
  18. #include    <mos.h>
  19.  
  20. #define NOP        (-1)
  21. #define OFF        0
  22. #define STP        1
  23. #define PLY        2
  24. #define PAU        3
  25. #define DEC        4
  26. #define INC        5
  27. #define CHG        6
  28. #define NOR        7
  29. #define OVR        8
  30.  
  31. #define ON        1
  32. #define MouseLeftButton  1
  33. #define MouseRightButton 2
  34. #define Chigh    25
  35. #define BR_COLOR    15        /* 明るい */
  36. #define EX_COLOR    7        /* XOR */
  37. #define SH_COLOR    8        /* 影 */
  38. #define BB_COLOR    13        /* 明るい水色 */
  39. #define BS_COLOR    5        /* 暗い水色 */
  40. #define BC_COLOR    0        /* 黒 */
  41.  
  42. typedef struct{
  43.     signed char min;
  44.     signed char sec;
  45.     signed char frame;
  46. } CDtime;
  47.  
  48. static char *G_W;
  49. static char para[64];
  50. static int Xorg;
  51. static int CYorg;
  52.  
  53. static void
  54. G_triangle(int x1,int y1,int x2,int y2,int x3,int y3,int col)
  55. {
  56.     EGB_color(G_W,0,col);
  57.     EGB_color(G_W,2,col);
  58.     EGB_paintMode(G_W,0x22);
  59.     WORD(para+0)=x1;
  60.     WORD(para+2)=y1;
  61.     WORD(para+4)=x2;
  62.     WORD(para+6)=y2;
  63.     WORD(para+8)=x3;
  64.     WORD(para+10)=y3;
  65.     EGB_triangle(G_W,para);
  66. }
  67.  
  68. static void
  69. G_xorTriangle(int x1,int y1,int x2,int y2,int x3,int y3,int col)
  70. {
  71.     EGB_color(G_W,0,col);
  72.     EGB_color(G_W,2,col);
  73.     EGB_paintMode(G_W,0x22);
  74.     EGB_writeMode(G_W,4);
  75.     WORD(para+0)=x1;
  76.     WORD(para+2)=y1;
  77.     WORD(para+4)=x2;
  78.     WORD(para+6)=y2;
  79.     WORD(para+8)=x3;
  80.     WORD(para+10)=y3;
  81.     EGB_triangle(G_W,para);
  82.     EGB_writeMode(G_W,0);
  83. }
  84.  
  85. static void
  86. G_line(int x1,int y1,int x2,int y2,int col)
  87. {
  88.     EGB_color(G_W,0,col);
  89.     WORD(para+0)=2;
  90.     WORD(para+2)=x1;
  91.     WORD(para+4)=y1;
  92.     WORD(para+6)=x2;
  93.     WORD(para+8)=y2;
  94.     EGB_connect(G_W,para);
  95. }
  96.  
  97. static void
  98. G_connect3(int x1,int y1,int x2,int y2,int x3,int y3,int col)
  99. {
  100.     EGB_color(G_W,0,col);
  101.     EGB_color(G_W,2,col);
  102.     WORD(para+0)=3;
  103.     WORD(para+2)=x1;
  104.     WORD(para+4)=y1;
  105.     WORD(para+6)=x2;
  106.     WORD(para+8)=y2;
  107.     WORD(para+10)=x3;
  108.     WORD(para+12)=y3;
  109.     EGB_connect(G_W,para);
  110. }
  111.  
  112. static void
  113. G_xorConnect3(int x1,int y1,int x2,int y2,int x3,int y3,int col)
  114. {
  115.     EGB_color(G_W,0,col);
  116.     EGB_color(G_W,2,col);
  117.     EGB_paintMode(G_W,0x22);
  118.     EGB_writeMode(G_W,4);
  119.     WORD(para+0)=3;
  120.     WORD(para+2)=x1;
  121.     WORD(para+4)=y1;
  122.     WORD(para+6)=x2;
  123.     WORD(para+8)=y2;
  124.     WORD(para+10)=x3;
  125.     WORD(para+12)=y3;
  126.     EGB_connect(G_W,para);
  127.     EGB_writeMode(G_W,0);
  128. }
  129.  
  130. static void
  131. G_rectangle(int x1,int y1,int x2,int y2,int col)
  132. {
  133.     EGB_color(G_W,0,col);
  134.     EGB_color(G_W,2,col);
  135.     EGB_paintMode(G_W,0x22);
  136.     WORD(para+0)=x1;
  137.     WORD(para+2)=y1;
  138.     WORD(para+4)=x2;
  139.     WORD(para+6)=y2;
  140.     EGB_rectangle(G_W,para);
  141. }
  142.  
  143. static void
  144. G_xorRectangle(int x1,int y1,int x2,int y2,int col)
  145. {
  146.     EGB_color(G_W,0,col);
  147.     EGB_color(G_W,2,col);
  148.     EGB_paintMode(G_W,0x22);
  149.     EGB_writeMode(G_W,4);
  150.     WORD(para+0)=x1;
  151.     WORD(para+2)=y1;
  152.     WORD(para+4)=x2;
  153.     WORD(para+6)=y2;
  154.     EGB_rectangle(G_W,para);
  155.     EGB_writeMode(G_W,0);
  156. }
  157.  
  158. static void
  159. G_rectBox(int x1,int y1,int x2,int y2,int col)
  160. {
  161.     EGB_color(G_W,0,col);
  162.     EGB_paintMode(G_W,0x02);
  163.     WORD(para+0)=x1;
  164.     WORD(para+2)=y1;
  165.     WORD(para+4)=x2;
  166.     WORD(para+6)=y2;
  167.     EGB_rectangle(G_W,para);
  168. }
  169.  
  170. static void
  171. G_xorRectBox(int x1,int y1,int x2,int y2,int col)
  172. {
  173.     EGB_color(G_W,0,col);
  174.     EGB_paintMode(G_W,0x02);
  175.     EGB_writeMode(G_W,4);
  176.     WORD(para+0)=x1;
  177.     WORD(para+2)=y1;
  178.     WORD(para+4)=x2;
  179.     WORD(para+6)=y2;
  180.     EGB_rectangle(G_W,para);
  181.     EGB_writeMode(G_W,0);
  182. }
  183.  
  184. static int
  185. M_getposi(int *mx,int *my)
  186. {
  187.     int mb;
  188.  
  189.     MOS_rdpos(&mb,mx,my);
  190.     return mb;
  191. }
  192.  
  193. static void
  194. paneloff(void)
  195. {
  196.     G_rectangle(Xorg-6,CYorg,Xorg+193,CYorg+Chigh+7,BC_COLOR);
  197. }
  198.  
  199. static void
  200. paneldisp(int lay,int sha)
  201. {
  202.     int x=Xorg;
  203.     int y=CYorg;
  204.  
  205.     if (lay>=0)
  206.     {
  207.         EGB_writePage(G_W,lay);
  208.         EGB_displayPage(G_W,lay,3);
  209.         MOS_writePage(lay);
  210.     }
  211.     /* パネル枠 */
  212.     G_rectangle(x,y,x+171,y+Chigh,EX_COLOR);
  213.     G_rectBox(x,y,x+171,y+Chigh,BB_COLOR);
  214.     /* パネル影 */
  215.     if (sha)
  216.     {
  217.         G_xorRectangle(x+172,y+5,x+177,y+Chigh+7,SH_COLOR);
  218.         G_xorRectangle(x+5,y+Chigh+1,x+171,y+Chigh+7,SH_COLOR);
  219.     }
  220.     /* CD */
  221.     /* 表示窓 */
  222.     G_rectangle(x+3,y+3,x+21,y+Chigh-3,BS_COLOR);
  223.     G_line(x+24,y+1,x+24,y+Chigh-1,SH_COLOR);
  224.     G_xorConnect3(x+3,y+Chigh-3,x+3,y+3,x+21,y+3,BB_COLOR);
  225.     /* ストップボタン */
  226.     /* ボタン1 */
  227.     x+=21+3*2;
  228.     G_connect3(x,y+Chigh-3,x,y+3,x+21,y+3,BR_COLOR);
  229.     G_connect3(x+1,y+Chigh-4,x+1,y+4,x+20,y+4,BR_COLOR);
  230.     G_connect3(x+1,y+Chigh-3,x+21,y+Chigh-3,x+21,y+4,SH_COLOR);
  231.     G_connect3(x+2,y+Chigh-4,x+20,y+Chigh-4,x+20,y+5,SH_COLOR);
  232.     G_rectangle(x+7,y+9,x+14,y+Chigh-9,BR_COLOR);
  233.     /* プレイボタン */
  234.     /* ボタン2 */
  235.     x+=21+3;
  236.     G_connect3(x,y+Chigh-3,x,y+3,x+45,y+3,BR_COLOR);
  237.     G_connect3(x+1,y+Chigh-4,x+1,y+4,x+44,y+4,BR_COLOR);
  238.     G_connect3(x+1,y+Chigh-3,x+45,y+Chigh-3,x+45,y+4,SH_COLOR);
  239.     G_connect3(x+2,y+Chigh-4,x+44,y+Chigh-4,x+44,y+5,SH_COLOR);
  240.     G_triangle(x+14,y+8,x+31,y+Chigh/2,x+14,y+Chigh-8,BR_COLOR);
  241.     /* ポーズボタン */
  242.     /* ボタン3 */
  243.     x+=21*2+3*2;
  244.     G_connect3(x,y+Chigh-3,x,y+3,x+21,y+3,BR_COLOR);
  245.     G_connect3(x+1,y+Chigh-3-1,x+1,y+4,x+20,y+4,BR_COLOR);
  246.     G_connect3(x+1,y+Chigh-3,x+21,y+Chigh-3,x+21,y+4,SH_COLOR);
  247.     G_connect3(x+2,y+Chigh-4,x+20,y+Chigh-4,x+20,y+5,SH_COLOR);
  248.     G_rectangle(x+6,y+8,x+9,y+Chigh-8,BR_COLOR);
  249.     G_rectangle(x+12,y+8,x+15,y+Chigh-8,BR_COLOR);
  250.     /* デクリメントボタン */
  251.     /* ボタン4 */
  252.     x+=21+3;
  253.     G_connect3(x,y+Chigh-3,x,y+3,x+21,y+3,BR_COLOR);
  254.     G_connect3(x+1,y+Chigh-4,x+1,y+4,x+20,y+4,BR_COLOR);
  255.     G_connect3(x+1,y+Chigh-3,x+21,y+Chigh-3,x+21,y+4,SH_COLOR);
  256.     G_connect3(x+2,y+Chigh-4,x+20,y+Chigh-4,x+20,y+5,SH_COLOR);
  257.     G_triangle(x+5,y+Chigh/2,x+10,y+7,x+10,y+Chigh-8,BR_COLOR);
  258.     G_triangle(x+11,y+Chigh/2,x+16,y+7,x+16,y+Chigh-8,BR_COLOR);
  259.     /* インクリメントボタン */
  260.     /* ボタン5 */
  261.     x+=21+3;
  262.     G_connect3(x,y+Chigh-3,x,y+3,x+21,y+3,BR_COLOR);
  263.     G_connect3(x+1,y+Chigh-4,x+1,y+4,x+20,y+4,BR_COLOR);
  264.     G_connect3(x+1,y+Chigh-3,x+21,y+Chigh-3,x+21,y+4,SH_COLOR);
  265.     G_connect3(x+2,y+Chigh-4,x+20,y+Chigh-4,x+20,y+5,SH_COLOR);
  266.     G_triangle(x+5,y+7,x+10,y+Chigh/2,x+5,y+Chigh-8,BR_COLOR);
  267.     G_triangle(x+11,y+7,x+16,y+Chigh/2,x+11,y+Chigh-8,BR_COLOR);
  268. }
  269.  
  270. static int bx[7];
  271.  
  272. static void
  273. buttonOn(int n,int status)
  274. {
  275.     int y=CYorg;
  276.     static int flag=0;
  277.  
  278.     if (status!=flag)
  279.     {
  280.         MOS_disp(OFF);
  281.         G_xorRectBox(bx[n],y+3,bx[n+1]-3,y+Chigh-3,EX_COLOR);
  282.         G_xorRectBox(bx[n]+1,y+4,bx[n+1]-4,y+Chigh-4,EX_COLOR);
  283.         switch (n)
  284.         {
  285.             case STP: G_xorRectangle(bx[n]+7,y+9,bx[n]+14,y+Chigh-9,EX_COLOR);
  286.                       break;
  287.             case PLY: G_xorTriangle(bx[n]+14,y+8,bx[n]+31,y+Chigh/2,
  288.                             bx[n]+14,y+Chigh-8,EX_COLOR);
  289.                       break;
  290.             case PAU: G_xorRectangle(bx[n]+6,y+8,bx[n]+9,y+Chigh-8,EX_COLOR);
  291.                       G_xorRectangle(bx[n]+12,y+8,bx[n]+15,y+Chigh-8,EX_COLOR);
  292.                       break;
  293.             case DEC: G_xorTriangle(bx[n]+5,y+Chigh/2,bx[n]+10,y+7,
  294.                             bx[n]+10,y+Chigh-8,EX_COLOR);
  295.                       G_xorTriangle(bx[n]+11,y+Chigh/2,bx[n]+16,y+7,
  296.                             bx[n]+16,y+Chigh-8,EX_COLOR);
  297.                       break;
  298.             case INC: G_xorTriangle(bx[n]+5,y+7,bx[n]+10,y+Chigh/2,
  299.                             bx[n]+5,y+Chigh-8,EX_COLOR);
  300.                       G_xorTriangle(bx[n]+11,y+7,bx[n]+16,y+Chigh/2,
  301.                             bx[n]+11,y+Chigh-8,EX_COLOR);
  302.                       break;
  303.             defaulte: break;
  304.         }
  305.         flag=status;
  306.         MOS_disp(ON);
  307.     }
  308. }
  309.  
  310. static int
  311. checkbutton(int mx,int my)
  312. {
  313.     int i;
  314.     int y=CYorg;
  315.     int ret=0;
  316.  
  317.     for (i=5; i>0; i--)
  318.     {
  319.         if (bx[i]<mx&&mx<bx[i+1]-3)
  320.         {
  321.             if (y+3<my&&my<y+Chigh-4)
  322.             {
  323.                 ret=i;
  324.                 break;
  325.             }
  326.         }
  327.     }
  328.     return ret;
  329. }
  330.     
  331. static int
  332. checkBposi(int bnum,int mx,int my)
  333. {
  334.     int ret=0;
  335.     int y=CYorg;
  336.  
  337.     if (bx[bnum]<mx&&mx<bx[bnum+1]-3)
  338.         if (y+3<my&&my<y+Chigh-4)
  339.             ret=1;
  340.     return ret;
  341. }
  342.  
  343. static int
  344. cdplaycheck(int *err)
  345. {
  346.     CDtime starttime;
  347.     CDtime endtime;
  348.     int status;
  349.     int nowmusicno;
  350.  
  351.     *err=cdr_mphase(0,&status,&nowmusicno,
  352.         (char *)&starttime,(char *)&endtime);
  353.     if (status&&!*err)
  354.         return nowmusicno;
  355.     else if (!*err)
  356.         return 0;
  357.     else
  358.         return (-1);
  359. }
  360.  
  361. static void
  362. dispcdwin(int n,int sw)
  363. {
  364.     int x=Xorg;
  365.     int y=CYorg;
  366.     static int prn=0;
  367.  
  368.     if (n==prn&&sw==0)
  369.         return;
  370.     MOS_disp(OFF);
  371.     G_rectangle(x+4,y+4,x+21,y+Chigh-3,BS_COLOR);
  372.     if (n==0)
  373.     {
  374.         MOS_disp(ON);
  375.         return;
  376.     }
  377.     EGB_color(G_W,0,BR_COLOR);
  378.     if (n>9)
  379.     {
  380.         para[6]=n/10+'0';
  381.         n%=10;
  382.     }
  383.     else
  384.         para[6]='0';
  385.     para[7]=n+'0';
  386.     para[8]='\0';
  387.     WORD(para+0)=Xorg+5;
  388.     WORD(para+2)=CYorg+21;
  389.     WORD(para+4)=2;
  390.     EGB_sjisString(G_W,para);
  391.     MOS_disp(ON);
  392.     prn=n+(para[6]-'0')*10;
  393. }
  394.  
  395. static int
  396. cdevent(int num)
  397. {
  398.     int err=0;
  399.     int mx;
  400.     int my;
  401.     int bnum;
  402.     int pnum;
  403.     int event=NOP;
  404.     static int p=0;
  405.  
  406.     MOS_disp(ON);
  407.     if (!num)
  408.     {
  409.         event=CHG;
  410.         do    /* CDがセットされるか、マウス右クリックされるまで */
  411.         {
  412.             cdplaycheck(&err);
  413.             if(M_getposi(&mx,&my)==MouseRightButton)
  414.             {
  415.                 event=OFF;
  416.                 break;
  417.             }
  418.         } while (err!=0x80);
  419.     }
  420.     while (event==NOP)
  421.     {
  422.         pnum=cdplaycheck(&err);
  423.         if (err==0x80)
  424.         {
  425.             event=CHG;
  426.             break;
  427.         }
  428.         else if (err)
  429.         {
  430.             event=NOR;
  431.             break;
  432.         }
  433.         if (pnum>0)
  434.         {
  435.             p=ON;
  436.             if (pnum>99)
  437.             {
  438.                 event=STP;
  439.                 p=OFF;
  440.                 break;
  441.             }
  442.             dispcdwin(pnum,0);
  443.         }
  444.         if (M_getposi(&mx,&my)==MouseRightButton)
  445.         {
  446.             event=OFF;
  447.             break;
  448.         }
  449.         if (!pnum)
  450.         {
  451.             if(p)
  452.             {
  453.                 event=OVR;
  454.                 p=OFF;
  455.                 break;
  456.             }
  457.         }
  458.         if ((M_getposi(&mx,&my)&MouseLeftButton)==1)
  459.         {
  460.             bnum=checkbutton(mx,my);
  461.             if (!bnum)
  462.             {
  463.                 while ((M_getposi(&mx,&my)&MouseLeftButton)!=0);
  464.                 continue;
  465.             }
  466.             while ((M_getposi(&mx,&my)&MouseLeftButton)!=0)
  467.             {
  468.                 if (checkBposi(bnum,mx,my))
  469.                     buttonOn(bnum,ON);
  470.                 else
  471.                     buttonOn(bnum,OFF);
  472.             }
  473.             if (checkBposi(bnum,mx,my))
  474.             {
  475.                 buttonOn(bnum,OFF);
  476.                 event=bnum;
  477.                 if (event==STP||event==PAU)
  478.                     p=OFF;
  479.                 break;
  480.             }
  481.         }
  482.     }
  483.     MOS_disp(OFF);
  484.     return event;
  485. }
  486.  
  487.  
  488. static void
  489. cdplay(int num,CDtime cdtrack[])
  490. {
  491.     cdr_mtplay(0,(char *)&cdtrack[num],(char *)&cdtrack[0]);
  492. }
  493.  
  494. void
  495. _cdda(int lay,int px,int py,int sha,char *_gw)
  496. {
  497. /*    lay    : 書き込みページ
  498.  *                    0:レイヤ0
  499.  *                    1:レイヤ1
  500.  *                   -1:呼出し側の設定のまま    
  501.  *    px    : パネル左上X座標
  502.  *    py    : パネル左上Y座標
  503.  *    sha    : パネル影    1:影有り
  504.  *                    0:影無し
  505.  *    _gw    : EGBワーク
  506.  */
  507.     int cdcheck;
  508.     int eventnum;
  509.     int err;
  510.     static int cdtype;
  511.     static int pnum=0;
  512.     static int playf=0;
  513.     static int pausef=0;
  514.     static int starttrack=0;
  515.     static int endtrack=0;
  516.     static CDtime tracktime[100];
  517.  
  518.     Xorg=px;
  519.     CYorg=py;
  520.     G_W=_gw;
  521.     bx[0]=0;        /* ダミー */
  522.     bx[1]=Xorg+27;    /* ボタン1 */
  523.     bx[2]=Xorg+51;    /* ボタン2 */
  524.     bx[3]=Xorg+99;    /* ボタン3 */
  525.     bx[4]=Xorg+123;    /* ボタン4 */
  526.     bx[5]=Xorg+147;    /* ボタン5 */
  527.     bx[6]=Xorg+171;    /* ダミー */
  528.     eventnum=NOP;
  529.     paneldisp(lay,sha);
  530.     cdcheck=cdplaycheck(&err);
  531.     if (cdcheck>0)                            /* 演奏中 */
  532.         dispcdwin(pnum=cdcheck,1);
  533.     else if (pausef)                        /* ポーズ中 */
  534.         dispcdwin(pnum,1);
  535.     else if ((cdcheck==0) && endtrack)        /* セット済、待機中 */
  536.         dispcdwin(pnum=starttrack,1);
  537.     else if ((err==0x80)||(endtrack==0))    /* CDセット */
  538.     {
  539.         err=cdr_cdinfo(0,&cdtype,&starttrack,&endtrack,
  540.             (char *)&tracktime[1],(char *)&tracktime[0]);
  541.         if (!err)
  542.         {
  543.             tracktime[0].frame--;
  544.             if (tracktime[0].frame<0)
  545.             {
  546.                 tracktime[0].frame=74;
  547.                 tracktime[0].sec--;
  548.                 if (tracktime[0].sec<0)
  549.                 {
  550.                     tracktime[0].sec=59;
  551.                     tracktime[0].min--;
  552.                 }
  553.             }
  554.             if (cdtype==1)
  555.                 dispcdwin(pnum=starttrack,1);
  556.             else if (cdtype==3)
  557.                 dispcdwin(pnum=starttrack=2,1);
  558.             else
  559.                 dispcdwin(pnum=endtrack=0,1);
  560.             cdr_mstop(0);
  561.         }
  562.     }
  563.     else                                    /* CDがセットされていない */
  564.         dispcdwin(pnum=endtrack=0,1);
  565.     SND_elevol_set(1,127,127);
  566.     while (eventnum!=OFF)
  567.     {
  568.         eventnum=cdevent(pnum);
  569.         switch(eventnum)
  570.         {
  571.             case CHG:    err=cdr_cdinfo(0,&cdtype,&starttrack,&endtrack,
  572.                             (char *)&tracktime[1],(char *)&tracktime[0]);
  573.                         if (!err)
  574.                         {
  575.                             tracktime[0].frame--;
  576.                             if (tracktime[0].frame<0)
  577.                             {
  578.                                 tracktime[0].frame=74;
  579.                                 tracktime[0].sec--;
  580.                                 if (tracktime[0].sec<0)
  581.                                 {
  582.                                     tracktime[0].sec=59;
  583.                                     tracktime[0].min--;
  584.                                 }
  585.                             }
  586.                             if (cdtype==1)
  587.                                 dispcdwin(pnum=starttrack,1);
  588.                             else if (cdtype==3)
  589.                                 dispcdwin(pnum=starttrack=2,1);
  590.                             else
  591.                                 dispcdwin(pnum=endtrack=0,1);
  592.                             cdr_mstop(0);
  593.                         }
  594.                         else
  595.                             dispcdwin(pnum=endtrack=0,1);
  596.                         break;
  597.             case NOR:    starttrack=0;
  598.                         endtrack=0;
  599.                         dispcdwin(pnum=0,1);
  600.                         break;
  601.             case STP:    cdr_mstop(0);
  602.                         dispcdwin(pnum=starttrack,1);
  603.                         pausef=OFF;
  604.                         playf=OFF;
  605.                         break;
  606.             case PLY:    if (!cdplaycheck(&err)&&pnum&&!playf)
  607.                         {
  608.                             cdplay(pnum,tracktime);
  609.                             cdr_continue(0);
  610.                             playf=ON;
  611.                         }
  612.                         else if (pausef)
  613.                             cdr_continue(0);
  614.                         pausef=OFF;
  615.                         break;
  616.             case PAU:    if ((cdcheck=cdplaycheck(&err))>0)
  617.                         {
  618.                             cdr_pause(0);
  619.                         }
  620.                         else if (!cdcheck)
  621.                         {
  622.                             cdplay(pnum,tracktime);
  623.                             cdr_pause(0);
  624.                         }
  625.                         pausef=ON;
  626.                         break;
  627.             case DEC:    if ((cdcheck=cdplaycheck(&err))>0)
  628.                         {
  629.                             if (cdcheck-1>=starttrack)
  630.                             {
  631.                                 pnum=cdcheck-1;
  632.                                 cdr_pause(0);
  633.                                 cdplay(pnum,tracktime);
  634.                                 cdr_continue(0);
  635.                             }
  636.                         }
  637.                         else if (endtrack)
  638.                         {
  639.                             pnum--;
  640.                             if (pnum<starttrack)
  641.                                 pnum=starttrack;
  642.                             dispcdwin(pnum,1);
  643.                         }
  644.                         break;
  645.             case INC:    if ((cdcheck=cdplaycheck(&err))>0)
  646.                         {
  647.                             if (cdcheck+1<=endtrack)
  648.                             {
  649.                                 pnum=cdcheck+1;
  650.                                 cdr_pause(0);
  651.                                 cdplay(pnum,tracktime);
  652.                                 cdr_continue(0);
  653.                             }
  654.                         }
  655.                         else if (endtrack)
  656.                         {
  657.                             pnum++;
  658.                             if (pnum>endtrack)
  659.                                 pnum=endtrack;
  660.                             dispcdwin(pnum,1);
  661.                         }
  662.                         break;
  663.             case OVR:    if (playf&&!pausef)
  664.                         {
  665.                             cdr_mstop(0);
  666.                             dispcdwin(pnum=starttrack,1);
  667.                         }
  668.                         break;
  669.             default:    break;
  670.         }
  671.     }
  672.     paneloff();
  673. }
  674.  
  675. /*
  676.  
  677. char Egbwk[1536];
  678. char Moswk[4096];
  679.  
  680. void
  681. main()
  682. {
  683.     EGB_init(Egbwk,1536);
  684.     MOS_start(Moswk,4096);
  685.     MOS_resolution(1,3);
  686.     _cdda(1,200,200,1,Egbwk);
  687.     MOS_end();
  688. }
  689. */
  690.  
  691.